const initChart = (elm, data,echarts) => {
  const xData = ["前庭平衡觉", "本体觉", "触觉"];
  const yData = [data.subjectScore1, data.subjectScore2, data.subjectScore3];

  const myChart = echarts.init(document.getElementById(elm));

  // 指定图表的配置项和数据
  const option = {
    color: "#5594F4",
    polar: {
      radius: [30, '80%']
    },
    angleAxis: {
      max: 100,
      startAngle: 90,
      endAngle: -180,
      axisLabel: {
        show: true,
        interval: 0,
      },
      axisLine: {
        lineStyle: {
          color: "#5594F4"
        }
      }
    },
    radiusAxis: {
      type: 'category',
      data: xData,
      name: "整体",
      nameLocation: "start",
      nameGap: 22,
      boundaryGap: true,
      axisLabel: {
        show: true,
        interval: 0,
        fontSize: 9
      },
      nameTextStyle: {
        color: "#5594F4",
        fontWeight: "bold",
        fontSize: "16px"
      }
    },
    tooltip: {},
    series: {
      type: 'bar',
      barWidth: "10px",
      data: yData,
      coordinateSystem: 'polar',
      itemStyle: {
        color: "#5594F4"
      }
    }
  };

  // 使用刚指定的配置项和数据显示图表。
  myChart.setOption(option);
}

export default initChart